home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / technical documentation / macintosh technotes and q&as / qa / tb / whiteedittext / answershell.c next >
Encoding:
C/C++ Source or Header  |  1997-12-10  |  1.1 KB  |  63 lines

  1. #define OLDROUTINELOCATIONS        0
  2. #define OLDROUTINENAMES            0
  3. #define SystemSevenOrLater        1
  4.  
  5. #ifndef __FONTS__
  6. #    include <Fonts.h>
  7. #endif
  8.  
  9. #ifndef __DIALOGS__
  10. #    include <Dialogs.h>
  11. #endif
  12.  
  13. #include "MoveableModalDialog.h"
  14.  
  15. static pascal OSErr InitMac (void)
  16. {
  17.     MaxApplZone ( );
  18.     InitGraf (&(qd.thePort));
  19.     InitFonts ( );
  20.     InitWindows ( );
  21.     InitMenus ( );
  22.     TEInit ( );
  23.     InitDialogs (nil);
  24.  
  25.     return noErr;
  26. }
  27.  
  28. static pascal Boolean ModalFilterProc (DialogRef dialog, EventRecord *event, short *itemHit)
  29. {
  30.     return StdFilterProc (dialog,event,itemHit);
  31. }
  32.  
  33. void main (void)
  34. {
  35.     if (InitMac ( ))
  36.         SysBeep (10);
  37.     else
  38.     {
  39.         DialogRef dlgRef = GetNewDialog (129,nil,(WindowRef)-1);
  40.         if (dlgRef)
  41.         {
  42.             ModalFilterUPP modalFilterUPP = NewModalFilterProc (ModalFilterProc);
  43.             if (modalFilterUPP)
  44.             {
  45.  
  46.                 short itemHit;
  47.  
  48.                 SetDialogDefaultItem (dlgRef,ok);
  49.                 SetDialogTracksCursor (dlgRef,true);
  50.  
  51.                 do
  52.                 {
  53.                     MoveableModalDialog (modalFilterUPP,&itemHit);
  54.                 }
  55.                 while (itemHit != ok);
  56.  
  57.                 DisposeRoutineDescriptor (modalFilterUPP);
  58.             }
  59.             DisposeDialog (dlgRef);
  60.         }
  61.     }
  62. }
  63.